package io.modifier.basic.compose.hooks

import androidx.compose.runtime.Composable

/** 获取当前组件是否已经卸载的 Hook **/
@Composable
fun useUnmountedRef(): Ref<Boolean> {
    val unmountedRef = useRef(default = false)
    useMount {
        unmountedRef.current = false
    }
    useUnmount {
        unmountedRef.current = true
    }
    return unmountedRef
}
